<%@ include file="connect.jsp" %>

<%
    String user = request.getParameter("txtUser");
    String pass = request.getParameter("txtPass");

    if (user == null || user == "") {
        response.sendRedirect("login.jsp?respon=Please insert the correct username!");
    } else if (pass == null || pass == "") {
        response.sendRedirect("login.jsp?respon=Please insert the correct password!");
    } else {
        ResultSet rs = stat.executeQuery("select * from Account where UserName like '" + user + "' and Password like '" + pass + "' ");
        if (rs.next()) {

            session.setAttribute("namaUser", user);
            response.sendRedirect("categories.jsp");
        } else {
            response.sendRedirect("login.jsp?respon=Wrong username or password!");
        }


    }
    conn.close();
%>